﻿--
-- Dropping stored procedure pr_ChiTietPhieuMuaHang_SelectAll : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuMuaHang_SelectAll]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuMuaHang_SelectAll]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuMuaHang_SelectAll
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:41 PM
-- Description:	This stored procedure is intended for selecting all rows from ChiTietPhieuMuaHang table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuMuaHang_SelectAll
As
Begin
	Select 
		[MaPhieuMH],
		[MaHH],
		[SoLuong]
	From ChiTietPhieuMuaHang
End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuMuaHang_SelectRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuMuaHang_SelectRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuMuaHang_SelectRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuMuaHang_SelectRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:41 PM
-- Description:	This stored procedure is intended for selecting a specific row from ChiTietPhieuMuaHang table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuMuaHang_SelectRow
	@MaPhieuMH varchar(10),
	@MaHH varchar(10)
As
Begin
	Select 
		[MaPhieuMH],
		[MaHH],
		[SoLuong]
	From ChiTietPhieuMuaHang
	Where
		[MaPhieuMH] = @MaPhieuMH
		and [MaHH] = @MaHH
End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuMuaHang_Insert : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuMuaHang_Insert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuMuaHang_Insert]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuMuaHang_Insert
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:41 PM
-- Description:	This stored procedure is intended for inserting values to ChiTietPhieuMuaHang table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuMuaHang_Insert
	@MaPhieuMH varchar(10),
	@MaHH varchar(10),
	@SoLuong int
As
Begin
	Insert Into ChiTietPhieuMuaHang
		([MaPhieuMH],[MaHH],[SoLuong])
	Values
		(@MaPhieuMH,@MaHH,@SoLuong)

End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuMuaHang_Update : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuMuaHang_Update]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuMuaHang_Update]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuMuaHang_Update
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:41 PM
-- Description:	This stored procedure is intended for updating ChiTietPhieuMuaHang table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuMuaHang_Update
	@MaPhieuMH varchar(10),
	@MaHH varchar(10),
	@SoLuong int
As
Begin
	Update ChiTietPhieuMuaHang
	Set
		[SoLuong] = @SoLuong
	Where		
		[MaPhieuMH] = @MaPhieuMH
		and [MaHH] = @MaHH

End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuMuaHang_DeleteRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuMuaHang_DeleteRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuMuaHang_DeleteRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuMuaHang_DeleteRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:41 PM
-- Description:	This stored procedure is intended for deleting a specific row from ChiTietPhieuMuaHang table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuMuaHang_DeleteRow
	@MaPhieuMH varchar(10),
	@MaHH varchar(10)
As
Begin
	Delete ChiTietPhieuMuaHang
	Where
		[MaPhieuMH] = @MaPhieuMH
		and [MaHH] = @MaHH

End

GO
